﻿<UserControl x:Class="NMortgage.UI.Views.LoanProfileView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Properties="clr-namespace:NMortgage.UI.Properties"
             xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
             xmlns:wpf="http://schemas.microsoft.com/wpf/2008/toolkit"
             mc:Ignorable="d"
             d:DesignHeight="700"
             d:DesignWidth="1100">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Themes/LoanProfileStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="4*" MinHeight="200" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="4*" MinHeight="175" />
            <RowDefinition Height="Auto" />            
            <RowDefinition Height="2*" MinHeight="100" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="4*" MinWidth="290" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition  Width="4*" MinWidth="250" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition  Width="4*" MinWidth="250" />
        </Grid.ColumnDefinitions>
        <Border Style="{StaticResource Section}"  Grid.RowSpan="3">
            <StackPanel>
                <StackPanel Style="{StaticResource Row}">
                    <Label Content="{x:Static Properties:Resources.ProfileLabelLoanAmount}" />
                    <toolkit:DecimalUpDown Style="{StaticResource PriceInput}"
                                           Value="{Binding Path=LoanAmount}"
                                           HorizontalAlignment="Stretch"  
                                           Width="140" />
                </StackPanel>
                <StackPanel Style="{StaticResource Row}">
                    <Label Content="{x:Static Properties:Resources.ProfileLabelTermLength}" />
                    <toolkit:IntegerUpDown Value="{Binding Path=TermLength}"
                                    HorizontalAlignment="Stretch"        
                                    Minimum="1"
                                    Width="140" />
                </StackPanel>
                <StackPanel Style="{StaticResource Row}">
                    <Label Content="{x:Static Properties:Resources.ProfileLabelStartDate}" />
                    <wpf:DatePicker SelectedDate="{Binding Path=StartDate}"
                                    HorizontalAlignment="Stretch" 
                                    Width="140" />
                </StackPanel>
                <StackPanel Style="{StaticResource Row}">
                    <Label Content="{x:Static Properties:Resources.ProfileLabelPaymentFreq}" />
                    <ListBox Style="{StaticResource RadioListStyle}"
                             SelectedItem="{Binding Path=SelectedPaymentFrequency}"
                             ItemsSource="{Binding Path=AvailableFrequencies}"
                             Width="140" />
                </StackPanel>
            </StackPanel>
        </Border>

        <Border Style="{StaticResource Section}" Grid.Row="0" Grid.Column="2" Grid.RowSpan="3" />
        <Border Style="{StaticResource Section}" Grid.Row="0" Grid.Column="4" />
        <Border Style="{StaticResource Section}" Grid.Row="2" Grid.Column="4" />
        
        <Border Style="{StaticResource Section}" Grid.Row="4" Grid.ColumnSpan="5">
            <StackPanel>
                <StackPanel Style="{StaticResource Row}">
                    <Label Content="{x:Static Properties:Resources.SummaryLabelEstimatedPayback}" 
                           Width="170"/>
                    <TextBlock Text="{Binding Path=EstimatedTotalPayback, StringFormat={}{0:C}}"
                               VerticalAlignment="Center" Width="150" />
                </StackPanel>
                <StackPanel Style="{StaticResource Row}">
                    <Label Content="{x:Static Properties:Resources.SummaryLabelEstimatedInterest}" 
                           Width="170"/>
                    <TextBlock Text="{Binding Path=EstimatedInterest, StringFormat={}{0:C}}" 
                               VerticalAlignment="Center" Width="150" />
                </StackPanel>
                <StackPanel Style="{StaticResource Row}">
                    <Label Content="{x:Static Properties:Resources.SummaryLabelPeriodicPayment}" 
                           Width="170"/>
                    <TextBlock Text="{Binding Path=EstimatedPeriodicPayment, StringFormat={}{0:C}}" 
                               VerticalAlignment="Center" Width="150" />
                </StackPanel>                
            </StackPanel>
        </Border>

        <ContentControl x:Name="InterestRates" Grid.Column="2" Grid.Row="0"  Grid.RowSpan="3" />
        <ContentControl x:Name="Payments" Grid.Column="4" Grid.Row="0" />
        <ContentControl x:Name="Fees" Grid.Column="4" Grid.Row="2" />

        <GridSplitter Style="{StaticResource VGridSplit}" 
                  Grid.Column="1" Grid.RowSpan="3" />
        <GridSplitter Style="{StaticResource VGridSplit}" 
                  Grid.Column="3" Grid.RowSpan="3" />
        <GridSplitter Style="{StaticResource HGridSplit}" 
                  Grid.Column="4" Grid.Row="1" HorizontalAlignment="Stretch" />
        <GridSplitter Style="{StaticResource HGridSplit}" 
                  Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="5" HorizontalAlignment="Stretch" />
    </Grid>
</UserControl>
